package com.lin.beibeipatent.controller;

import com.lin.beibeipatent.pojo.Patent;
import com.lin.beibeipatent.service.PatentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * @author ChenweiLin
 * @create 2021-09-20 21:11
 */
@Controller
@RequestMapping("/hello")
@Slf4j
public class TestController {
    @Autowired
    private PatentService patentService;

    @GetMapping("/test")
    @ResponseBody
    public String test1(){
        return "hello";
    }

    @PostMapping("/test2")
    @ResponseBody
    public Patent test2(@RequestParam("id") Integer id){
        Patent patent = patentService.getPatentById(id);
        log.info(patent.toString());
        return patent;
    }

}
